<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<link href="css/table.css" rel="stylesheet" type="text/css" />
<link href="css/excite-bike/jquery-ui-1.8.22.custom.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="js/jquery-ui-1.8.22.custom.min.js"></script>
<script src="js/widgets.js"></script>
<script type="text/javascript">
	
	function Click_Reset() {
		$.each($(".require_from_group"), function(i, val) { //將每個欄位都設為空字串
			val["value"] = "";
		});
		$("#q_message").html("");	//效果不太一樣，頂著先
		$("#square").css("visibility", "hidden");
	}
	
	function moving(tpid){
		$.cookie("currStatus", "updateTP");
		$.cookie("tpid", tpid);
		window.location = "CreateTP.html";
	}

	$(document).ready(function() {
		$("#sub_tpOwnerList")[0].value ="";
		$("#dialog-Group").css("visibility", "hidden");
		$("button").button();
		$("#square").css("visibility", "hidden");
		$("input[id$=Date]").datepicker({
			dateFormat : "yy-mm-dd"
		});
		
		$("#loginUser")[0].value = $.cookie("userID");
		$("#dialog-delTP").css("visibility", "hidden");	//刪除測試計畫案
	});
	
	
	function click_deleteTP(tpid,tpName) {
		$("#dialog-delTP").prop("title","刪除測試計畫案");
		$('#q_tpID2')[0].value = tpid;
		$('#delTP_tpid').html(tpid+"-"+tpName);
		$("#dialog-delTP").css("visibility", "visible");
		$("#dialog-delTP").dialog({
			resizable : true,
			width : 300,
			height : 300,
			modal : true,
			buttons : {
				"確定" : function() {
					$.ajax({
						type : 'post',
						url : 'DeleteTP',
						data : $('#q_form_mapping').serializeArray(),
						dataType : 'TEXT',
						success : function(queryResult) {
							$('#tr_'+tpid).remove();
							refreshUI('resultTable_b',1);
							alert(queryResult);
						}
					});
					$(this).dialog("close");
				},"關閉" : function() {
					$(this).dialog("close");
				}
			}
		});
	}
	
</script>
</head>
<body>
	<form id="q_form" method="post">
		<table>
			<tr>
				<th colspan="2" valign="middle" scope="col">請輸入查詢條件</th>
			</tr>
			<tr>
				<th valign="middle" scope="col">
					<div align="right">計畫編號：</div>
				</th>
				<td scope="col"><div align="left">
					<input type="text" name="q_tpID" id="q_tpID" class="require_from_group" />
					</div></td>
			</tr>
			<tr>
				<th valign="middle"><div align="right">計畫名稱：</div></th>
				<td bgcolor="#CCCCCC"><input type="text" name="q_tpName"
					id="q_tpName" class="require_from_group" /></td>
			</tr>
			<tr>
				<th valign="middle"><div align="right">計畫案負責人：</div></th>
				<td>
				<button type="button" id="tdTPOwner" onClick="pickAllStaff('tpOwner')">選擇</button><ul id="tpOwner"></ul>
				
				</td>
			</tr>
			<tr>
				<th rowspan="2" valign="middle"><div align="right">建立日期：</div>
					<div align="right"></div></th>
				<td bgcolor="#CCCCCC">
					起：<input type="text" name="q_cfromDate" id="q_cfromDate" class="require_from_group" />
				</td>
			</tr>
			<tr>
				<td>
					迄：<input type="text" name="q_ctoDate" id="q_ctoDate" class="require_from_group" />
				</td>
			</tr>
			<tr>
				<th rowspan="2" valign="middle"><div align="right">最後修改日期：</div></th>
				<td bgcolor="#CCCCCC">
					起：<input type="text" name="q_ufromDate" id="q_ufromDate" class="require_from_group" />
				</td>
			</tr>
			<tr>
				<td>
					迄：<input type="text" name="q_utoDate" id="q_utoDate" class="require_from_group" />
				</td>
			</tr>
			<tr>
				<th>&nbsp;</th>
				<td bgcolor="#CCCCCC">
					<button type="button" id="clickS" onClick="Click_QueryTP('1')">送出查詢</button>
					<button type="button" id="clickReset" onClick="Click_Reset()">重設</button>
				</td>
			</tr>
			<tr>
				<th>&nbsp;</th>
				<td id="q_message" class="require_from_group">&nbsp;</td>
			</tr>
		</table>
		<input type="hidden" id="sub_tpOwnerList" name="tpOwnerList" />			<!-- 測試案負責人 -->
		<input type="hidden" id="sub_er" name="er" />							<!-- 要查詢的後端角色為 -->		
	</form>
	
	<form id='q_form_mapping' method="post">
		<input type="hidden" id='q_tpID2' name='q_tpID' value='' />
		<input type="hidden" id="loginUser" name="loginUser" />					<!-- 目前登入的使用者 -->
	</form>
	
	
	<div id="square">
		<p>&nbsp;</p>
		<h2 id="ReaultNum"></h2>
		<hr />

		<table id="resultTable">
			<thead id="resultTable_h">
				<tr>
					<th>#</th>
					<th>計畫案名稱</th>
					<th>&nbsp;</th>
				</tr>
			</thead>
			
			<tbody id="resultTable_b">
			</tbody>
		</table>
	</div>
	
	<div id="dialog-Group" title="請勾選人員">
		<table>
			<thead>
				<tr>
					<th><input type="checkbox" id="tpoCheckALL" onClick="chkALL('tpo')"/></th>
					<th>#</th>
					<th>人員列表</th>
				</tr>
			</thead>
			
			<tbody id="tBodyTPOwner">
			
			</tbody>
		</table>
	</div>
	
	<div id="dialog-delTP">
	<table>
		<tbody id="ConfirmDelTP">
		<tr><th>確定刪除</th></tr>
		<tr><td id="delTP_tpid"></td></tr>
		
		</tbody>
	</table>
	</div>

</body>
</html>